package com.bawei.a2010douyin.base.http;

import com.bawei.a2010douyin.base.utils.ConstantUtils;
import com.bawei.a2010douyin.entity.BaseResponse;
import com.bawei.a2010douyin.entity.CommentEntity;
import com.bawei.a2010douyin.entity.DanmakuEntity;
import com.bawei.a2010douyin.entity.GiftEntity;
import com.bawei.a2010douyin.entity.GoodsEntity;
import com.bawei.a2010douyin.entity.LoginEntity;
import com.bawei.a2010douyin.entity.PushEntity;
import com.bawei.a2010douyin.entity.RegisterEntity;
import com.bawei.a2010douyin.entity.VideoEntity;

import java.util.List;

import io.reactivex.Observable;
import okhttp3.MultipartBody;
import okhttp3.RequestBody;
import retrofit2.http.Body;
import retrofit2.http.GET;
import retrofit2.http.Multipart;
import retrofit2.http.POST;
import retrofit2.http.Part;
import retrofit2.http.Query;

/**
 @Query 请求参数 提交的数据拼接在url网址后面
 @Body  请求体 提交的数据不会拼接在url后面
 */
public interface ApiServer {
    //视频
    @GET(ConstantUtils.VIDEO_URL)
    Observable<BaseResponse<List<VideoEntity>>>  video(@Query("currentPage") int currentPage, @Query("pageSize") int pageSize);
    //商品
    @GET(ConstantUtils.GOODS_URL)
    Observable<BaseResponse<List<GoodsEntity>>> goods(@Query("category_id") int category_id,@Query("currentPage") int currentPage, @Query("pageSize") int pageSize);
    //登陆
    @POST(ConstantUtils.LOGIN_URL)
    Observable<BaseResponse<LoginEntity>> login(@Body RequestBody requestBody);
    //注册
    @POST(ConstantUtils.REGISTER_URL)
    Observable<BaseResponse<RegisterEntity>> register(@Body RequestBody requestBody);
    //点赞
    @POST(ConstantUtils.LOVE_URL)
    Observable<BaseResponse<String>> love(@Query("videoId") int videoId);
    //取消点赞
    @POST(ConstantUtils.NOLOVE_URL)
    Observable<BaseResponse<String>> nolove(@Query("videoId") int videoId);
    //礼物
    @GET(ConstantUtils.GIFT_URL)
    Observable<BaseResponse<List<GiftEntity>>> gift();
    //关注
    @POST(ConstantUtils.GUANZHU_URL)
    Observable<BaseResponse<String>> guanzhu(@Body RequestBody requestBody);
    //获得评论
    @GET(ConstantUtils.COMMETN_URL)
    Observable<BaseResponse<List<CommentEntity>>> comment(@Query("videoId") int videoId);
    //发表评论
    @POST(ConstantUtils.SEND_COMMENT_URL)
    Observable<BaseResponse<List<CommentEntity>>> sendComment(@Body RequestBody requestBody);
    //弹幕
    @GET(ConstantUtils.DANMAKU_URL)
    Observable<BaseResponse<List<DanmakuEntity>>> getDanMus(@Query("videoId") int videoId);
    //开始推流
    @POST(ConstantUtils.START_PUSH_URL)
    Observable<BaseResponse<PushEntity>> startPush(@Body RequestBody requestBody);
    //停止推流
    @POST(ConstantUtils.STOP_PUSH_URL)
    Observable<BaseResponse<String>> stopPush();
    //获得点拶的视频
    @POST(ConstantUtils.DIANZANVIDEOS_URL)
    Observable<BaseResponse<List<VideoEntity>>> getDianZanvideos();
    //修改头像
    @Multipart
    @POST(ConstantUtils.UPDATEICON_URL)
    Observable<BaseResponse<String>> updateIcon(@Part MultipartBody.Part file);

}
